const list = [
    {
        "id": 1,
        "content": "你放屁",
        "author": "小阿三",
        "user_id": 1,
        "create_time": 1631955977733,
        "likes": 0,
        "blog_id": 1,
        "parent_id": 0
    },
    {
        "id": 2,
        "content": "你放屁",
        "author": "小阿三",
        "user_id": 1,
        "create_time": 1631956057698,
        "likes": 0,
        "blog_id": 1,
        "parent_id": 0
    },
    {
        "id": 3,
        "content": "你放屁",
        "author": "小阿三",
        "user_id": 1,
        "create_time": 1631956067258,
        "likes": 0,
        "blog_id": 1,
        "parent_id": 0
    },
    {
        "id": 4,
        "content": "今天又胖了",
        "author": "cxh",
        "user_id": 1,
        "create_time": 1631956403909,
        "likes": 0,
        "blog_id": 1,
        "parent_id": 0,
        children: [
            {
                "id": 5,
                "content": "没关系，我也胖",
                "author": "lxl",
                "user_id": 2,
                "create_time": 1631956452215,
                "likes": 0,
                "blog_id": 1,
                "parent_id": 4
            }
        ]
    },

]

const newList = list.filter(item => item.parent_id === 0)
newList.forEach(item => {
    list.forEach(item2 => {
        if (item2.parent_id === item.id) {
            if (item.children) {
                item.children.push(item2)
            } else {
                item.children = [item2]
            }
        }
    })
})
console.log(newList)